#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#include <unordered_map>
using namespace std;
vector<int> a;
unordered_map<int, int> h;
unordered_map<int, int> r;
const int N = 1000010;
int main() {
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        int temp;
        cin >> temp;
        a.push_back(temp);
        h[temp]++;
    }
    for(int i = 1; i <= N; i++) {
        if(!h[i]) {
            continue;
        }
        for(int j = 1; j <= N / i; j++) {
            if(h[i * j]) r[i * j] += h[i];
            if(i * j == i) r[i]--;
        }
    }
    for(auto& e : a) {
        cout << r[e] << endl;
    }
    return 0;
}